[C] converting Bit Field to int
Posted
by shaharg
on Stack Overflow
See other posts from Stack Overflow
or by shaharg
Published on 2010-03-18T09:37:43Z
Indexed on
2010/03/18
9:41 UTC
Read the original article
Hit count: 267
Hi, I have bit field declared this way:
typedef struct morder {
unsigned int targetRegister : 3;
unsigned int targetMethodOfAddressing : 3;
unsigned int originRegister : 3;
unsigned int originMethodOfAddressing : 3;
unsigned int oCode : 4;
} bitset;
I also have int array, and i want to get int value from this array, that represents the actual value of this bit field (which is actually some kind of machine word that i have the parts of it, and i want the int representation of the whole word).
Thanks a lot.
© Stack Overflow or respective owner